<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>活动统计管理</title>
	<meta name="decorator" content="default"/>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/base.css">
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnExport").click(function(){
				var year = $("#zq").find("option:selected").val();
				//document.location.href = "${ctx}/approve/statisticPerson/export?year="+year;
				top.$.jBox.confirm("确认要导出党员积分统计吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						document.location.href = "${ctx}/approve/statisticParty/export?year="+year;				
						//$("#searchForm").attr("action","${ctx}/approve/statisticPerson/export");
						//$("#searchForm").submit();
						

					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<div class="col-xs-6">
		<div class="row-space">
			<div class="e-box float-e-margins" style="height: 370px;">
				<div class="e-box-title">
					<h2>组织生活统计</h2>
				</div>
				<div class="e-box-content">
					<div id="zjtr" style="width: 100%; height: 355px;"></div>
				</div>
			</div>
		</div>
	</div>
	<form:form id="searchForm" modelAttribute="organizeLife" action="${ctx}/approve/statisticParty/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input type="hidden" id="orgId" value="${orgId}"/>
		<input type="hidden" id="typeId" value="${typeId}"/>
		<ul class="ul-form">
			
			
			<li><label>年度：</label> 
			<form:select path="zq" class="input-medium">
					<form:options items="${fns:findAssessmentTimeList()}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			
			<li><label>状态：</label>
				<form:select path="jhstate" class="input-medium" id="jhstateSelect" style="width:80px">
					<form:option value="" label="全部"/>
					<form:options items="${fns:getDictList('life_state_flag')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
                 <li class="btns">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="btnSubmit" class="btn" type="submit" value="查询" /></li>
			     <li class="btns"><input id="btnExport" class="btn" type="button" value="导出"/></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th style="width:5px;">序号</th>
				<th style="width:30%">活动名称</th>
				<th style="width:15%">分类</th>
				<th style="width:15%">状态</th>
				<th style="width:15%">计划时间</th>
				<th style="width:20%">活动地点</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="organizeLife" varStatus="rowIndex">
			<tr>
			    <td style='text-align: center'>${rowIndex.index+1}</td>
				<td><a href="${ctx}/life/organizeLife/form?id=${organizeLife.id}">
					<div style="width:320px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;" 
					title="${organizeLife.lifename}">${organizeLife.lifename}</div>
				</a></td>
				
				<td>
<div style="width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;" 
					title="${organizeLife.typeids}">${organizeLife.typeids}</div>				</td>
				<td style='text-align: center'>
					${fns:getDictLabel(organizeLife.jhstate, 'life_state_flag', '')}
				</td>
				<td style='text-align: center'>
					<fmt:formatDate value="${organizeLife.jhtime}" pattern="yyyy-MM-dd HH:mm"/>
				</td>				
				<td>
					<div style="width:320px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;" 
					title="${organizeLife.adress}">${organizeLife.adress}</div>
				</td>			
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<script src="${pageContext.request.contextPath}/static/js/jquery-1.10.2.js" type="text/javascript" charset="utf-8"></script>
	<script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="${pageContext.request.contextPath}/static/echarts/echarts.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$(function(){			
			findPartyStatisticChart();
		});
		
		//查询按钮点击事件
		function query(){
			$("#searchForm").submit();
			findPartyStatisticChart();
			
		}
	
		//查询组织信息下拉
		function queryOrg(typeId,orgId){
			$.ajax({
				url:'${ctx}/approve/partyStatistic/findOrganizeNameByTypeId',
				type:"post",
				data:{"typeId":typeId},
				dataType:"json",
				success:function(data){
					$("#orgIdSelect").empty();
					var html = "<option value=''>全部</option>";
					$("#orgIdSelect").append(html);
					for(var i in data){
						var organizationName = data[i].organizationName;
						var organizationId = data[i].organizationId;
						if(orgId==organizationId){
							var html = "<option value='"+organizationId+"' selected>"+organizationName+"</option>";
						}else{
							var html = "<option value='"+organizationId+"'>"+organizationName+"</option>";
						}
						$("#orgIdSelect").append(html);
					}
				}
			});
		}
	
		var options = {
		  	title : {
		        text: '每月活动开展情况'
		    },
			legend : {
				show : false,
				data:['党组织积分']
			},
			xAxis : {
				axisLabel : {
					textStyle : {
						fontSize : 10
					},
					rotate : 0
				},
				data : []
			},
			yAxis : {
				name : '次数',
				axisLabel : {
					textStyle : {
						fontSize : 10
					},
					formatter : function(value, index) {
						return value;
					}
				}
			},
			series : [ {
				name : '月份',
				type : 'bar',
				barMinHeight : 10,
				label : {
					normal : {
						show : true,
						position : 'top',
						textStyle : {
							fontWeight : 'bold',
							fontSize : 10
						}
					}
				},
				itemStyle : {
					normal : {
						color : function(params) {
							var colorList = [ '#cc3333', '#146ddc', '#f99d41',
												'#67b320', '#cc3333', '#146ddc', '#f99d41','#EFE42A','#EE9201','#B74AE5', '#ca8622' ,'#FF8463'];
							return colorList[params.dataIndex];
						},
						opacity : 0.8
					}
				},
				data : []
			} ]
		};
		
		
		//查询前10名党组织积分柱状图
		function findPartyStatisticChart(){
			var zq = $("#zq").val();			
			$.ajax({
				url:'${ctx}/approve/statisticParty/findListByMonth',
				type:"post",
				data:{
					"zq" : zq
				},
				dataType:"json",
				success:function(data){
					var personName = [];
					var month = [];
					personName.push("一月");
					personName.push("二月");
					personName.push("三月");
					personName.push("四月");
					personName.push("五月");
					personName.push("六月");
					personName.push("七月");
					personName.push("八月");
					personName.push("九月");
					personName.push("十月");
					personName.push("十一月");
					personName.push("十二月");
						month.push(data.january);				
						month.push(data.february);
						month.push(data.march);
						month.push(data.april);
						month.push(data.may);
						month.push(data.june);
						month.push(data.july);
						month.push(data.august);
						month.push(data.september);
						month.push(data.october);
						month.push(data.november);
						month.push(data.december);
					
					options.series[0].data = month;
					options.xAxis.data = personName;
					var zjtrChart = echarts.init(document.getElementById('zjtr'));
				    zjtrChart.setOption(options);
				}
			});
		}
		
	</script>
</body>
</html>